package com.cq.hd.admin.controller;

import com.cq.hd.admin.annotation.RequiresPermissionsDesc;
import com.cq.hd.common.enums.biz.PayStateEnum;
import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.member.api.TbMemberCardBillApi;
import com.cq.hd.member.api.dto.AdminMemberCardBillPageDto;
import com.cq.hd.member.api.vo.AdminMemberCardBillPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Api(tags = "次卡购买记录相关接口")
@Slf4j
@RestController
@RequestMapping("/memberCardBill")
public class TbMemberCardBillController extends BaseController {

    @Autowired
    private TbMemberCardBillApi memberCardBillApi;

    @ApiOperation(value = "查询累计成交金额")
    @ApiResponse(response = BigDecimal.class, code = 200, message = "接口返回对象参数")
    @RequiresPermissions("finance:memberCardBill:getTotalAmt")
    @RequiresPermissionsDesc(menu = {"财务管理", "次卡购买记录"}, button = "查询累计成交金额")
    @GetMapping("/getTotalAmt")
    public Result<BigDecimal> getTotalAmt() {
        return memberCardBillApi.getTotalAmt();
    }

    @ApiOperation(value = "次卡购买记录列表")
    @ApiResponse(response = AdminMemberCardBillPageVo.class, code = 200, message = "接口返回对象参数")
    @RequiresPermissions("finance:memberCardBill:list")
    @RequiresPermissionsDesc(menu = {"财务管理", "次卡购买记录"}, button = "查询")
    @GetMapping("/page")
    public Result<Page<AdminMemberCardBillPageVo>> pageAdminMemberCardBill(AdminMemberCardBillPageDto adminMemberCardBillPageDto) {
//        adminMemberCardBillPageDto.setPayState(PayStateEnum.SUCCESS.getValue());
        return memberCardBillApi.pageAdminMemberCardBill(adminMemberCardBillPageDto);
    }


}
